"""
给定一个十进制数，把他转换成k进制
除k求余法
"""
from ADT import Stack


def digit(base, k):
    arr = '0123456789ABCDEF'
    res = ''
    stack = Stack()
    while base != 0:
        stack.push(arr[base % k])
        base = base // k
    while not stack.isEmpty():
        res += stack.pop()
    return int(res)


print(digit(100, 16))  # 64
print(int('64', 16))  # 100



